package com.ssy.lingxi.system.common;


import java.util.stream.Stream;

/**
 * 商城属性
 * @author fhj
 * @date 2021/09/25
 * @version 2.0.0
 */
public enum ShopConfigPropertyEnum {

    B_SHOP(1,"B端商城"),
    C_SHOP(2, "C端商城"),
    B_SELF_SHOP(3, "B端自营商城"),
    C_SELF_SHOP(4, "C端自营商城"),
    ;

    Integer code;
    String message;

    /**
     * 判断是否为自营商城
     * @param code 商城属性
     */
    public static boolean checkSelfShop(Integer code) {
        return Stream.of(B_SELF_SHOP, C_SELF_SHOP).anyMatch(o -> o.getCode().equals(code));
    }

    ShopConfigPropertyEnum(Integer code, String message) {
        this.message = message;
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }
}
